<template>
  <!-- 生产检测 -->
  <div>
    <div class="incolumn_countr">
      <div class="block">
        <el-form :inline="true" :model="formInline">
          <el-form-item label="输入搜索">
            <el-input v-model="formInline.key" placeholder="请输入合作公司" style="width:150%"></el-input>
          </el-form-item>
          <el-form-item label="输入时间" label-width="230px">
            <el-date-picker
              v-model="formInline.time1"
              type="daterange"
              range-separator="-"
              start-placeholder="开始日期"
              end-placeholder="结束日期"
              @change="chage"
            ></el-date-picker>
          </el-form-item>
          <el-form-item>
            <el-button type="primary" @click="onsubmit">查询</el-button>
          </el-form-item>
        </el-form>
      </div>
    </div>
    <div class="table-box">
      <template>
        <el-table :data="tableData" :height="620" :max-height="580" stripe>
          <el-table-column prop="xuhao" label="序号" type="index" align="center" width="100"></el-table-column>
          <el-table-column prop="productname" label="产品名称" align="center"></el-table-column>
          <el-table-column prop="productmodel" label="产品型号" align="center"></el-table-column>
          <el-table-column prop="createon" label="生产日期" align="center"></el-table-column>
          <el-table-column prop="number" label="生产数量" align="center"></el-table-column>
          <el-table-column prop="productionline" label="生产线" align="center" show-overflow-tooltip></el-table-column>
          <el-table-column prop="state" label="状态" align="center" show-overflow-tooltip></el-table-column>
          <el-table-column label="操作" align="center">
            <template slot-scope="scope">
              <el-button
                size="small"
                type="warning"
                v-show="scope.row.state =='生产中'"
                @click="jiance(scope.row)"
              >检测</el-button>
              <el-button size="small" type="primary">详情</el-button>
            </template>
          </el-table-column>
        </el-table>
      </template>
    </div>
    <!-- ========= 分页 =========== -->
    <div class="Bottom_Slate">
      <el-pagination
        background
        layout="prev, pager, next"
        :current-page="current"
        :page-size="pagesize"
        @current-change="handleCurrentChange"
        :total="total"
      ></el-pagination>
    </div>
    <!-- ================ 检测弹窗 ================== -->
    <el-dialog :visible.sync="dialogVisibleBy" :modal-append-to-body="false" width="70%">
      <ShengChang :fatherMethod="ProducTionCancel"></ShengChang>
    </el-dialog>
  </div>
</template>
<script>
import axios from "axios";
import ShengChang from "@/views/QualityManagement/PopupFile/ShengChangTesting.vue";

export default {
  components: {
    ShengChang
  },
  data() {
    return {
      //分页
      total: 1,
      current: 1,
      pagesize: 10,
      //List列表
      tableData: [
        {
          productname: "车盖科",
          productmodel: "UP-89",
          createon: "2018-8-8",
          unit: "UP-89",
          number: "10000",
          orderno: "TET-56898",
          productionline: "A组",
          state: "生产中"
        }
      ],
      //文本款
      formInline: {},
      //弹窗
      dialogVisibleBy: false
    };
  },
  created() {},
  methods: {
    // 分页
    handleCurrentChange(e) {
      this.getlist(e - 1);
    },
    //检测
    jiance() {
      this.dialogVisibleBy = true;
    },
    ProducTionCancel() {
      this.dialogVisibleBy = false;
    },
    // 筛选
    onsubmit() {
      this.getData(0);
    },
    // 日期筛选改变
    chage(e) {
      console.log(e);
      if (e) {
        this.start =
          e[0].getFullYear() +
          "-" +
          (e[0].getMonth() + 1) +
          "-" +
          e[0].getDate();
        this.end =
          e[1].getFullYear() +
          "-" +
          (e[1].getMonth() + 1) +
          "-" +
          e[1].getDate();
      } else {
        this.start = "";
        this.end = "";
      }
    }
  }
};
</script>

<style lang="scss" scoped>
@import "@/assets/scss/base.scss";
.incolumn_countr {
  margin-left: 15px;
  height: 50px;
  width: 97%;
  background-color: white;
  padding-top: 10px;
}
.block {
  margin-left: 20px;
  cursor: pointer;
}
//分页
.Bottom_Slate {
  height: 60px;
  margin-top: 20px;
  text-align: center;
}
</style>
